<?php if ($gtAccount != NULL){ ?>
<?php 
    $notApprovedRequests = array();
    $ApprovedRequests = array();
    foreach($requests as $request):
        if ($request['Request']['resolved_by'] == ''){
            $request['Request']['approved'] = 'No';
            $notApprovedRequests[] = $request;
        }
        else
        {
            $request['Request']['approved'] = 'Yes';
            $ApprovedRequests[] = $request;
        }
    endforeach;
?>
  <table>
        <tr>
            <td>
            <?php  
//            echo $this->Html->link('Make Request', 
//              array('controller' => 'Employee', 'action' => 'makerequest'));
            ?>
            </td>
        </tr>
  </table>
<?php  ?>
  <table>
        <tr>  
            <th>Request ID </th>
            <th>Employee ID </th>
            <th>Date </th>
            <th>Clock In </th>
            <th>Replaces </th>
            <th>Project ID </th>
            <th>Comment </th>
            <th>Resolved By </th>
            <th>Approved </th>
        </tr>  
            <?php foreach($notApprovedRequests as $request): ?>
                <tr>  
                   <td><?php echo $request['Request']['request_id']; ?></td>  
                   <td><?php echo $request['Request']['employee_id']; ?></td>  
                   <td><?php echo $request['Request']['date']; ?></td>  
                   <td><?php echo $request['Request']['clock_in']; ?></td>  
                   <td><?php echo $request['Request']['replaces']; ?></td>  
                   <td><?php echo $request['Request']['proj_id']; ?></td>  
                   <td><?php echo $request['Request']['comment']; ?></td>  
                   <td><?php echo $request['Request']['resolved_by']; ?></td>  
                   <td><?php echo $request['Request']['approved']; ?></td>  
                 </tr>  
            <?php endforeach; ?>  
 </table>
    
    Approved Requests
  <table>
        <tr>  
            <th>Request ID </th>
            <th>Employee ID </th>
            <th>Date </th>
            <th>Clock In </th>
            <th>Replaces </th>
            <th>Project ID </th>
            <th>Comment </th>
            <th>Resolved By </th>
            <th>Approved </th>
        </tr>  
            <?php foreach($ApprovedRequests as $request): ?>
                <tr>  
                   <td><?php echo $request['Request']['request_id']; ?></td>  
                   <td><?php echo $request['Request']['employee_id']; ?></td>  
                   <td><?php echo $request['Request']['date']; ?></td>  
                   <td><?php echo $request['Request']['clock_in']; ?></td>  
                   <td><?php echo $request['Request']['replaces']; ?></td>  
                   <td><?php echo $request['Request']['proj_id']; ?></td>  
                   <td><?php echo $request['Request']['comment']; ?></td>  
                   <td><?php echo $request['Request']['resolved_by']; ?></td>  
                   <td><?php echo $request['Request']['approved']; ?></td>  
                 </tr>  
            <?php endforeach; ?>  
 </table>

    
<?php } else{ ?>
<h1> Invalid Login </h1>
<?php }?>


 
